package com.broada.apm.dao.impl;

import java.util.List;

import com.broada.apm.dao.FilterDao;
import com.broada.apm.model.Filter;
import com.broada.apm.model.FilterRule;

public class MysqlFilterDao extends MysqlAbstractDao implements FilterDao {

	public static final String FILTER_NAMESPACE = "com.broada.apm.dao.FilterDao.";
	
	@Override
	public void addFilter(Filter filter) {
		getSqlSession().insert(FILTER_NAMESPACE + "addFilter", filter);
	}

	@Override
	public void truncateFilter(String analyzerId) {
		getSqlSession().delete(FILTER_NAMESPACE + "truncateFilter", analyzerId);
	}

	@Override
	public List<Filter> getAllFilters(String analyzerId) {
		return getSqlSession().selectList(FILTER_NAMESPACE + "getAllFilters", analyzerId);
	}
	
	@Override
	public List<FilterRule> getAllFiltersJson(String analyzerId) {
		return getSqlSession().selectList(FILTER_NAMESPACE + "getAllFiltersJson", analyzerId);
	}

	@Override
	public void truncateFilterById(String id) {
		getSqlSession().delete(FILTER_NAMESPACE + "truncateFilterById", id);
	}

}
